package com.ruoyi.app.controller;

import com.ruoyi.app.domain.ExamPackage;
import com.ruoyi.app.domain.ExamReport;
import com.ruoyi.app.domain.Patient;
import com.ruoyi.app.service.ExamPackageService;
import com.ruoyi.app.service.ExamReportService;
import com.ruoyi.app.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("report")
public class ExamRepotController {
    @Autowired
    private ExamReportService examReportService;
    @Autowired
    private PatientService patientService;
    @Autowired
    private ExamPackageService examPackageService;

    @RequestMapping("list")
    public ExamReport list(Long appointmentId){
        ExamReport examReport = examReportService.list(appointmentId);
        Patient patient = patientService.getSelectById(examReport.getPatientId());
        examReport.setPatientName(patient.getName());
        ExamPackage examPackage = examPackageService.getSelectById(examReport.getPackageId());
        examReport.setPackageName(examPackage.getPackageName());
        return examReport;
    }
}
